const Router = require('koa-router')
const { auth } = require('../middle/auth')
const router = new Router({
  prefix: '/question'
})

const {getQuestionlist, checkQuestionExist, findQuestionById, createQuestion, updatedQuestion, deleteQuestion} = require('../controllers/question')

router.get('/', getQuestionlist)
router.get('/:id', checkQuestionExist, findQuestionById)
router.post('/',auth, createQuestion)
router.patch('/:id', auth, checkQuestionExist, updatedQuestion)
router.delete('/:id', auth, checkQuestionExist, deleteQuestion)

module.exports = router